#include "../lib/kernel/print.h"
#include "interrupt.h"
#include "memory.h"
#include "../thread/thread.h"


void p(void * arg);
//extern unsigned int mem_size;

void main(void){
	/*print_string("Begin to enable interrupt.\n\r");
	asm ("movw $0x10, %ax;\
		movw %ax, %ds");
	en_intr();
	asm volatile("sti");
	//print_string("Interrupt enabled.");
	while(1) //Let kernel loop forever.
	{
		print_string("1111111111111\r\n");
		//asm volatile("sti");
		print_string("2222222222222\r\n");
		print_string("pppppppppppppppppppppppppppppppppppppp\r\n");
	}
	;       */    
	print_string("This machine's total memory size is:0x");
	unsigned int mem_size;
	mem_size = memsize();
	print_int(mem_size>>20);
	print_string("mb\r\n");

	mem_init();
	main_thread();
	en_intr();
	run_thread("func_p",31, p, "Thread1. ");
	
	enable_intr();
	while(1) 
		print_string("Main thread. ");
	while(1);
}

void p(void * arg)
{
	uint8_t * str = arg;
	while(1){
		print_string(str);
	}
	
}
